CC=gcc
CXX=g++
CFLAGS=-Wall $(DEBUG) $(DEFINITIONS) $(CINCLUDES) $(CMISCFLAGS)
CPPFLAGS=-Wall -ansi $(DEBUG) $(EXCEPTIONS) $(CPPINCLUDES) $(DEFINITIONS) $(CPPMISCFLAGS)
DEBUG=-O0 -g3
CMISCFLAGS=
CPPMISCFLAGS=
DEFINITIONS=-DLINUX_OS
EXCEPTIONS=-fexceptions
CINCLUDES=-I.
CPPINCLUDES=-I. -I../../lnmdefs

LD=g++
LDFLAGS=
LIBS=-lrt -lpthread

GDIR=../../../
SRCSC=
SRCSCPP=
VPATH=
CPPGIMI=
CGIMI=

## Build GIMI and it's dependencies.
## Files are set to CGIMI and CPPGIMI variables

## Construct final lists of CPP and C objects
OBJSC=$(SRCSC:.c=.o)
OBJSCPP=$(SRCSCPP:.cpp=.opp)

## Define compiles and links
COMPILEC=$(CC) $(CFLAGS) $(CINCLUDES) -c
COMPILECPP=$(CXX) $(CPPFLAGS) $(CPPINCLUDES) -c
LINK=$(LD) $(LDFLAGS) $(LIBS)

.PHONY: all clean

all: linetest xyzCadMapParser polylineCadMapParser

linetest: $(OBJSC) $(OBJSCPP) linetest.opp
			$(LINK) -o $@ $(OBJSC) $(OBJSCPP) linetest.opp

xyzCadMapParser: $(OBJSC) $(OBJSCPP)  xyzCadMapParser.opp
	$(LINK) -o $@ $(OBJSC) $(OBJSCPP) xyzCadMapParser.opp

polylineCadMapParser: $(OBJSC) $(OBJSCPP)  polylineCadMapParser.opp
	$(LINK) -o $@ $(OBJSC) $(OBJSCPP) polylineCadMapParser.opp

clean:
	rm -f $(OBJSC) $(OBJSCPP) linetest xyzCadMapParser polylineCadMapParser  *.out *~ *.d *.dpp *.opp

## Compile rule for all .o (.c) file
%.o:    %.c
				$(COMPILEC) -o $@ $<

## Compile rule for all .opp (.cpp) files
%.opp:	%.cpp
				$(COMPILECPP) -o $@ $<
